import matplotlib.pyplot as plt

# 读取文件内容
with open('input.txt', 'r') as file:
    lines = file.readlines()

# 去除每行的前后空白字符，并分割成数字
data = [list(map(float, line.strip().split())) for line in lines]

# 分离奇数行和偶数行
y_data = data[::2]  # 奇数行
x_data = data[1::2]  # 偶数行

# 将二维列表展平为一维列表
y_data_flat = [item for sublist in y_data for item in sublist]
x_data_flat = [item for sublist in x_data for item in sublist]

# 绘制散点图
plt.scatter(x_data_flat, y_data_flat)
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Scatter Plot from input.txt')
plt.grid(True)
plt.show()

